<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018-9-26
 * Time: 22:08
 */
/*
$dns="mysql:dbname=learn;host=127.0.01";
$username="root";
$password="";
*/

$name=$_GET["name"];
$tel=$_GET["tel"];
$rj=$_GET["rj"];


try{

    $pdo = new PDO("mysql:dbname=bk_ui;host=127.0.0.1","root","");
    echo "数据库连接成功。。。。<br>";

    $sql="INSERT into bk_user(name,tel,rj) VALUES (?,?,?)";

    $stml=$pdo->prepare($sql);

    $stml->bindValue(1,$name);
    $stml->bindValue(2,$tel);
    $stml->bindValue(3,$rj);

$res=$stml->execute();

if($res>0)
    echo "<br>添加用户成功";
else
    echo "<br>添加用户失败";
}catch (PDOException $e)
{
    echo "数据库连接出错:"+$e->getMessage();
}


echo '<meta http-equiv="refresh" content="1;url=db_content.php">';//修改
